<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset=utf-8>
	<meta name=renderer content=webkit>
	<meta http-equiv=x-ua-compatible content="IE=edge">
	<meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no">
	<title><th:block th:text="${title}"></th:block></title>
	<!-- Bootstrap CSS -->
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css">
	<link rel="shortcut icon" th:href="@{/static/favicon.ico}" type="image/x-icon">
	<!--隐藏滑动条-->
	<style>
		::-webkit-scrollbar {
			display: none
		}
	</style>
</head>

<body style="background:url(/static/admin/imgs/editor.png) no-repeat; background-size: cover;">
	<link rel="stylesheet" href="/static/admin/editormd/css/editormd.css" />
	<div class="container-fluid">
		<form id="articleForm">
			<div class="form-row" style="margin-left: 3%; margin-right: 3%; margin-top: 2%; vertical-align: center;">

				<input id="article-aid" type="hidden" th:value="${record!=null and record.id!=null }?${record.id}: ''" name="aid">
				<div class="col-md-6">
					<input id="article-title" type="text" th:value="${record!=null and record.title!=null }?${record.title}: ''"
						   class="form-control mb-6" placeholder="文章标题（必填）" name="title">
				</div>
				<div th:class="${record == null or record.status == 0}?'col-md-4':'col-md-5'">
					<select id="multiple-type" class="form-control" data-placeholder="请选择文章类型..">
						<th:block th:if="${null == record}">
							<option value="0" selected="selected">原创</option>
							<option value="1" >转载</option>
							<option value="2" >翻译</option>
						</th:block>
						<th:block th:unless="${null == record}">
							<option value="0" th:selected="${null != record and record.type=='0'} ? true : false">原创</option>
							<option value="1" th:selected="${null != record and record.type=='1'} ? true : false" >转载</option>
							<option value="2" th:selected="${null != record and record.type=='2'} ? true : false" >翻译</option>
						</th:block>
					</select>
				</div>
				<th:block th:if="${record == null or record.status == 0}">
					<div class="col-md-1">
						<a href="javascript:;" onclick="submit_article(0);"><button type="button" style="font-size: 80%;" class="form-control btn btn-warning mb-1">存为草稿</button></a>
					</div>
				</th:block>
				<div class="col-md-1">
					<a href="javascript:;" onclick="submit_article(-1);"><button type="button" style="font-size: 80%;" class="form-control btn btn-primary mb-1">保存修改</button></a>
				</div>
			</div>
			<div class="form-row" style="margin-left: 3%; margin-right: 3%; margin-top: 1%; vertical-align: center;">
				<div class="col-md-6">
					<input id="article-tags" style="font: 16px bold" type="text" th:value="${record!=null and record.tags!=null }?${record.tags}: ''" class="form-control mb-4" placeholder="文章标签" name="tags">
				</div>
				<div class="col-md-5">
					<select id="multiple-sel" class="form-control" data-placeholder="文章状态">
						<th:block th:if="${null == record or record.status==0}">
							<option value="1" selected="selected">公开</option>
							<option value="2" >私密</option>
						</th:block>
						<th:block th:if="${null != record and record.status != 0}">
							<option value="1" th:selected="${null != record and record.status=='1'} ? true : false" >公开</option>
							<option value="2" th:selected="${null != record and record.status=='2'} ? true : false" >私密</option>
						</th:block>
					</select>
				</div>
				<div class="col-md-1">
					<a target="_self" th:href="@{/admin/article}"><button type="button" style="font-size: 80%;" class="form-control btn btn-info mb-1">返回列表</button></a>
				</div>
			</div>
			<input type="hidden" name="content" id="article-content"/>
			<input type="hidden" name="status" id="article-status"/>
			<input type="hidden" name="type" id="article-type"/>
			<div class="form-row">
				<div id="test-editor">
					<textarea id="editor" th:utext="${record!=null and record.content !=null}?${record.content}: ''" style="display:none;"></textarea>
				</div>
			</div>
		</form>
		<div style="text-align: center; vertical-align: middle; font: 14px solid; color: white">
			<p>© 2020 听风合笙 &ensp; All rights reserved.</p>
		</div>
	</div>

	<script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/js/bootstrap.min.js"></script>
	<script src="/static/admin/editormd/editormd.min.js"></script>
	<script th:src="@{/static/admin/js/my.js}"></script>
	<script type="text/javascript">
		$(function() {
			var editor = editormd("test-editor", {
				width  : "95%",
				height : parseInt(window.screen.availHeight * 0.7),
				path   : "/static/admin/editormd/lib/",
				htmlDecode : "style,script,iframe,sub,sup,embed|onclick,title,onmouseover,onmouseout,style",

			});
		});
	</script>
</body>
</html>
